package com.olinsports.system.olinsportssystem.controller;

import com.olinsports.system.olinsportssystem.manager.SiteReservationManager;
import com.olinsports.system.olinsportssystem.manager.SiteTypeManager;
import com.olinsports.system.olinsportssystem.model.SiteReservation;
import com.olinsports.system.olinsportssystem.model.SiteType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2017/7/22.
 */
@Controller
@RequestMapping("siteRev")
public class SiteReservationController {
    @Autowired
    private SiteReservationManager siteReservationManager;

    @RequestMapping("/selectAll")
    @ResponseBody
    public List<SiteReservation> selectAll(){
        return siteReservationManager.selectAll();
    }
    @RequestMapping("/selectByScheduledDate")
    @ResponseBody
    public List<SiteReservation> selectByScheduledDate(String scheduledDate){
        System.out.println("scheduledDate = "+scheduledDate);
        return siteReservationManager.selectByScheduledDate(scheduledDate);
    }

    @RequestMapping("/insertAll")
    @ResponseBody
    public int insertAll(@RequestBody SiteReservation siteReservation, String[] revTime, int plyKey){
        return siteReservationManager.insertAll(siteReservation,revTime,plyKey);
    }
    @RequestMapping("/updatePayData")
    @ResponseBody
    public int updatePayData(@RequestBody SiteReservation siteReservation,int plyKey){
        return siteReservationManager.updatePayData(siteReservation,plyKey);
    }
    @RequestMapping("/unsubscribe")
    @ResponseBody
    public int unsubscribe(String scheduledDate,int plyKey,String vipNum,String state){
        return siteReservationManager.unsubscribe(scheduledDate,plyKey,vipNum,state);
    }

    @RequestMapping("/fixedSite")
    @ResponseBody
    public int fixedSite(@RequestBody SiteReservation siteReservation, String[] revTime,int plyKey,String startFixedDate,String endFixedDate){
        return siteReservationManager.fixedSite(siteReservation,revTime,plyKey,startFixedDate,endFixedDate);
    }
}
